// Copyright (c) 2020 cgsdfc
// 
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT

// Generated file. Don't edit!
#include "pyast/ast.h"

<%!
from astlib.cc_types import (
    ProductNode, AstNode, Location, TypeNode, ConstructorNode,
    FinalAstNode, Object)

def comma_if_members(cls):
    return ',' if len(cls.members) else ''
%>

namespace pyast {

%for cls in hierarchy.class_list:
    %if isinstance(cls, FinalAstNode):

        ${cls.name}::${cls.name}(${cls.formal_args} ${comma_if_members(cls)} Arena* arena)
            : ${cls.parent}{${cls.CallPyCreateFunc('arena')}, arena}
        {
            PYAST_INTERNAL_DCHECK(*this, "${cls.py_create_func}() returned nullptr.");
            %for m in cls.members:
                %if isinstance(m.type, Object):
                    arena->AddObject(${m.name});
                %endif
            %endfor
        }

    %endif
%endfor
}
